class BookReviewModel {
  int today;
  List<Docs> docs;
  bool ok;

  BookReviewModel({this.today, this.docs, this.ok});

  BookReviewModel.fromJson(Map<String, dynamic> json) {
    today = json['today'];
    if (json['docs'] != null) {
      docs = new List<Docs>();
      json['docs'].forEach((v) {
        docs.add(new Docs.fromJson(v));
      });
    }
    ok = json['ok'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['today'] = this.today;
    if (this.docs != null) {
      data['docs'] = this.docs.map((v) => v.toJson()).toList();
    }
    data['ok'] = this.ok;
    return data;
  }
}

class Docs {
  String sId;
  String rating;
  String type;
  Author author;
  Book book;
  String likeCount;
  String priority;
  String block;
  String state;
  String updated;
  String created;
  String content;

  Docs(
      {this.sId,
        this.rating,
        this.type,
        this.author,
        this.book,
        this.likeCount,
        this.priority,
        this.block,
        this.state,
        this.updated,
        this.created,
        this.content});

  Docs.fromJson(Map<String, dynamic> json) {
    sId = json['_id'].toString();
    rating = json['rating'].toString();
    type = json['type'].toString();
    author =
    json['author'] != null ? new Author.fromJson(json['author']) : null;
    book = json['book'] != null ? new Book.fromJson(json['book']) : null;
    likeCount = json['likeCount'].toString();
    priority = json['priority'].toString();
    block = json['block'].toString();
    state = json['state'].toString();
    updated = json['updated'].toString();
    created = json['created'].toString();
    content = json['content'].toString();
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['_id'] = this.sId;
    data['rating'] = this.rating;
    data['type'] = this.type;
    if (this.author != null) {
      data['author'] = this.author.toJson();
    }
    if (this.book != null) {
      data['book'] = this.book.toJson();
    }
    data['likeCount'] = this.likeCount;
    data['priority'] = this.priority;
    data['block'] = this.block;
    data['state'] = this.state;
    data['updated'] = this.updated;
    data['created'] = this.created;
    data['content'] = this.content;
    return data;
  }
}

class Author {
  String sId;
  String avatar;
  String nickname;
  String activityAvatar;
  String type;
  int lv;
  String gender;

  Author(
      {this.sId,
        this.avatar,
        this.nickname,
        this.activityAvatar,
        this.type,
        this.lv,
        this.gender});

  Author.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    avatar = json['avatar'];
    nickname = json['nickname'];
    activityAvatar = json['activityAvatar'];
    type = json['type'];
    lv = json['lv'];
    gender = json['gender'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['_id'] = this.sId;
    data['avatar'] = this.avatar;
    data['nickname'] = this.nickname;
    data['activityAvatar'] = this.activityAvatar;
    data['type'] = this.type;
    data['lv'] = this.lv;
    data['gender'] = this.gender;
    return data;
  }
}

class Book {
  String sId;
  String title;
  String cover;

  Book({this.sId, this.title, this.cover});

  Book.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    title = json['title'];
    cover = json['cover'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['_id'] = this.sId;
    data['title'] = this.title;
    data['cover'] = this.cover;
    return data;
  }
}
